package com.diligent.cloud.sfc.resources;

import com.canny.commons.model.ListResult;
import com.canny.commons.model.ObjectResult;
import com.canny.commons.model.Result;
import com.diligent.cloud.logistics.container.model.LcmBoxFill;
import com.diligent.cloud.logistics.container.model.LcmMoveApply;
import com.diligent.cloud.logistics.container.model.LcmTransport;
import com.diligent.cloud.logistics.container.model.LcmWeightApply;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;

import java.security.Principal;

/**
 * TransportResource interface
 * 车间运输资源
 *
 * @author xf107278
 * @date 3/27/2020
 */
@RequestMapping("/sfc")
public interface WorkshopTransportResource {

    @GetMapping("/transport/code-{code}-{systemId}")
    @ApiOperation(value = "车间物流/查询物流台账", notes = "车间物流/查询物流台账", tags = {"车间物流"})
    ResponseEntity<Result> searchTransport(@ApiParam(name = "code", value = "框号", type = "String") @PathVariable(
            "code") String code, @ApiParam(name = "systemId", value = "账套编号", type = "String") @PathVariable(
            "systemId") String systemId);

    @PostMapping("/transport")
    @ApiOperation(value = "车间物流/新增运输单", notes = "车间物流/新增运输单", tags = {"车间物流"})
    ResponseEntity<Result> addTransport(@ApiParam(name = "lcmTransport", value = "运输单信息", type = "lcmTransport") @RequestBody LcmTransport lcmTransport, @AuthenticationPrincipal Principal principal);

    @PostMapping("/box-fill")
    @ApiOperation(value = "车间物流/新增装卸物料单", notes = "车间物流/新增装卸物料单", tags = {"车间物流"})
    ResponseEntity<ObjectResult> addBoxFill(@RequestBody LcmBoxFill lcmBoxFill, @AuthenticationPrincipal Principal principal);

    @PostMapping("/weight-apply")
    @ApiOperation(value = "车间物流/新增容器过磅申请单", notes = "车间物流/新增容器过磅申请单", tags = {"车间物流"})
    ResponseEntity<Result> addWeightApply(@RequestBody LcmWeightApply lcmWeightApply, @AuthenticationPrincipal Principal principal);

    @PostMapping("/move-apply")
    @ApiOperation(value = "车间物流/新增移动单", notes = "车间物流/新增移动单", tags = {"车间物流"})
    ResponseEntity<Result> addMoveApply(@ApiParam(name = "moveApply", value = "移动单", type = "LcmMoveApply") @RequestBody LcmMoveApply moveApply, @AuthenticationPrincipal Principal principal);

    @GetMapping("/idle-box/{machCode}/{pageIndex}/{pageSize}")
    @ApiOperation(value = "车间物流/获取对应机台闲置框", notes = "车间物流/获取对应机台闲置框", tags = "车间物流")
    ResponseEntity<ListResult> getIdleBox(@ApiParam(name = "machCode", value = "机台号", type = "String") @PathVariable("machCode") String machCode, @PathVariable("pageIndex") Long pageIndex, @PathVariable("pageSize") Long pageSize);

}
